package com.hhkj.api.student.controller;

import com.hhkj.admin.bank.controller.BankController;
import com.hhkj.api.student.model.req.ApiSaleStudentCourseListReq;
import com.hhkj.api.student.model.req.ApiSaleStudentRegisterReq;
import com.hhkj.api.student.service.biz.ApiSaleStudentBizService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ApiSaleStudentController
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2023/12/26 15:31
 */
@RequestMapping("/api/sale/student")
@RestController
public class ApiSaleStudentController extends BankController {

    @Autowired
    private ApiSaleStudentBizService apiSaleStudentBizService;

    /** 学员科目列表 */
    @PostMapping("/course/list")
    public AjaxResult listCourse(@RequestBody ApiSaleStudentCourseListReq studentReq) {
        return AjaxResult.success(apiSaleStudentBizService.listCourse(studentReq));
    }

    /** 学员科目列表 多级联动 */
    @PostMapping("/multi/course/list")
    public TableDataInfo multiListCourse(@RequestBody ApiSaleStudentCourseListReq studentReq) {
        return getDataTable(apiSaleStudentBizService.multiListCourse(studentReq));
    }

    /** 学员注册 */
    @PostMapping("/register")
    public AjaxResult register(@RequestBody ApiSaleStudentRegisterReq req) {
        return apiSaleStudentBizService.register(req) ? AjaxResult.success() : AjaxResult.error();
    }
}
